package com.goldsprite.spinelearn.examples.gfsm.states;

import com.goldsprite.gdxcore.gfsm.State;
import com.goldsprite.spinelearn.examples.AnimType;
import com.goldsprite.spinelearn.examples.gfsm.SpineStateMachine;

public class SpineJumpState extends State<SpineStateMachine> {
	@Override
	public boolean canEnter() {
		return fsm.getInput().isJumping() &&
			fsm.getEntity().hasJumpAnimation();
	}

	@Override
	public boolean canExit() {
		return fsm.getEntity().isAnimationComplete() || fsm.getInput().isMoving();
	}

	@Override
	public void enter() {
		fsm.getInput().setJumping(false);
		fsm.getEntity().playAnim(AnimType.JUMP, false);
		System.out.println("进入跳跃状态");
	}
}
